#include "PiecePreview.h"

PiecePreview::PiecePreview()
        : BackgroundColor(Area(20, 240, 100, 100), Color(0, 0, 0, 150))
{
}

PiecePreview::~PiecePreview()
{
}

void PiecePreview::addBlock(Block* block)
{
    addChild(block);
}

void PiecePreview::clear()
{
    eraseChildren();
}

void PiecePreview::handleEvent(const Event& event)
{
    event.visitPiecePreview(this);
}

void PiecePreview::handlePreviewUpdate(const Position positions[], Color color)
{
    clear();
    for (int i = 0; i < 4; ++i)
    {
        addBlock(new Block(positions[i],color));
    }
}
